<template>
	<scroll-view scroll-y class="scroll_view" @scrolltolower="loadmore">
		<view class="list">
			<view class="item" v-for="item in _this.list">
				<!-- <view class="item_view" v-for="dataItem in item.product"> -->
				<view class="item_view">
					<image :src="item.product.img" class="cover"></image>
					<view class="item_info">
						<view class="name">{{item.product.name}}</view>
						<view class="label_view">
							<!-- <view class="label">单位：瓶</view> -->
							<view class="label">数量：{{item.product.number}}</view>
						</view>
						<view class="time">
							<view class="key">时间：</view>
							<view class="value">{{item.created_at}}</view>
						</view>
					</view>
				</view>
				<view class="cell_view">
					<view class="cell">
						<view class="key">用户ID：</view>
						<view class="value">{{item.users_id}}</view>
					</view>
					<view class="cell" v-if="item.user">
						<view class="key">用户名：</view>
						<view class="value">{{item.user.nickname}}</view>
					</view>
					<!-- <view class="cell">
						<view class="key">积分收益：</view>
						<view class="value">{{item.parent_integral}}</view>
					</view>
					<view class="cell">
						<view class="key">现金收益：</view>
						<view class="value">{{item.parent_balance}}元</view>
					</view> -->
					<view class="cell">
						<view class="key">付款金额：</view>
						<view class="value">{{item.total}}元</view>
					</view>
				</view>
			</view>
		</view>
		<uv-load-more :status="_this.loadmore_status" line @loadmore="loadmore" />
	</scroll-view>
</template>

<script setup>
	import {
		userBouns
	} from "@/request/api";
	import useList from "@/hooks/useList.js";
	const {
		_this
	} = useList();
	import {
		ref
	} from "vue";
	const getList = async () => {
		let {
			list
		} = await userBouns({
			status: 1,
			page: _this.page,
			limit: _this.limit
		});
		_this.last_page = list.last_page;
		list = list.list;
		_this.list = _this.page == 1 ? list : [..._this.list, ...list];
		_this.loadmore_status = _this.last_page == _this.page ? 'nomore' : 'loadmore';
	};
	getList();
	const loadmore = () => {
		if (_this.page >= _this.last_page) return;
		_this.page++;
		getList();
	};
</script>

<style>
</style>